# 获取CSV数据
import csv
import os

file_path = "./data"
def get_csv_data(file_path):
    """获取CSV数据

    Args:
        file_path (str): CSV文件路径

    Returns:
        Dict: CSV数据列表
    """
    raw_data = {}
    oid_data = {}
    with open(file_path, 'r') as file:
        reader = csv.reader(file)
        for raw in reader:
            if  raw[0] == "Name":
                continue
            else:
                raw_data[raw[0]] = raw[2]
                oid_data[raw[2]] = raw[0]
    return raw_data,oid_data

def get_all_csv_data():
    """获取所有CSV数据

    Returns:
        Dict: 所有CSV数据列表
    """
    data = {}
    for file in os.listdir(file_path):
        if file.endswith(".csv"):
            raw_data,oid_data = get_csv_data(os.path.join(file_path, file))
            data[file[0:-4]] = {"raw_data":raw_data,"oid_data":oid_data}
    return data

def get_oid_data():
    """获取所有OID数据

    Returns:
        Dict: 所有OID数据列表
    """
    data = {}
    for file in os.listdir(file_path):
        if file.endswith(".csv"):
            raw_data,oid_data = get_csv_data(os.path.join(file_path, file))
            data[file[0:-4]] = oid_data
    return data

def get_raw_data():
    """获取所有raw数据

    Returns:
        Dict: 所有raw数据列表
    """
    data = {}
    for file in os.listdir(file_path):
        if file.endswith(".csv"):
            raw_data,oid_data = get_csv_data(os.path.join(file_path, file))
            data[file[0:-4]] = raw_data
    return data


if __name__ == "__main__":
    data = get_raw_data()
    print(data)